<!-- 左侧导航 -->
import func from './vue-temp/vue-editor-bridge';
<template>
  <div class="content-nav">
      <div class="content-title">
          <i class="el-icon-document"></i>
          <span>{{nav.title}}</span>
      </div>
      <div class="content-list">
        <ul>
          <li @click="navLeftClick(item.id,item.title)" v-for="item in nav.data" :key="item.id" v-bind:class="{'active':item.active,'unactive':!item.active}">
            <span>{{item.title}}</span>
          </li>
          
        </ul>
      </div>
  </div>
</template>

<script>
import { ArticleList } from "@/api/data";

import store from "@/store/modules/webnav/index";

export default {
  data() {
    return {};
  },
  store,
  props: ["nav"],
  methods: {
    async navLeftClick(id, title) {
      this.$emit("updateData", id); //传递数据给父组件
      let json = new Object();
      json.id = id;
      json.title = title;
      this.$store.commit("toRightClick", json);

      //绑定数据
      let type = id;
      let jsondata = new Object();
      jsondata.page = 1;
      jsondata.limit = 10;
      const res = await ArticleList(jsondata, type);
      if (res.code == 0) {
        this.$store.commit("toRightDataBind", res);
      }
    }
  },

  /** 组件注册 */
  components: {}
};
</script>
<style scoped>
.content-title {
  color: #fff;
  height: 40px;
  line-height: 40px;
  background-color: #e14e06;
  text-align: center;
}
ul {
  padding: 20px 0;
}
li {
  padding: 10px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
}
.active,
li:hover {
  border-left: solid 4px #409eff;
  color: #409eff;
}
</style>